package com.shirley.designpattern.singleton;

/**
 * 饿汉式 线程安全，类加载式初始化
 * <p>
 * 缺点：容易产生垃圾对象，类加载时就初始化，浪费内存
 * 优点：没有加锁，执行效率高
 *
 * @author shirley
 */
public class HungrySingleton {
    private static HungrySingleton instance = new HungrySingleton();

    private HungrySingleton() {
    }

    public static HungrySingleton getInstance() {
        return instance;
    }
}
